package com.jr9z.jrjz.service.impl;

import com.jr9z.jrjz.dao.LeaveMsgMapper;
import com.jr9z.jrjz.entity.LeaveMsg;
import com.jr9z.jrjz.service.LeaveMsgService;
import com.jr9z.jrjz.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author:Mrzhang
 * @Description:
 * @Date:2019.03.31 14:16
 **/

@Service
public class LeaveMsgServiceImpl implements LeaveMsgService {

    @Autowired
    private LeaveMsgMapper leaveMsgMapper;

    @Override
    public LeaveMsg selectByPrimaryKey(Integer msgId) {
        return leaveMsgMapper.selectByPrimaryKey(msgId);
    }

    @Override
    public int deleteByPrimaryKey(Integer msgId) {
        return leaveMsgMapper.deleteByPrimaryKey(msgId);
    }

    @Override
    public Long getMsgCount() {
        return leaveMsgMapper.getMsgCount();
    }

    @Override
    public List<LeaveMsg> getMSgList() {
        return leaveMsgMapper.getMSgList();
    }

    @Override
    public int addLeaveMsg(LeaveMsg leaveMsg) {
        if (leaveMsg!=null){
            leaveMsg.setCreateTime(DateUtils.getCurrentDate());
            return leaveMsgMapper.addLeaveMsg(leaveMsg);
        }else{
            return 0;
        }
    }
}
